package Test;

import java.awt.MouseInfo;
import java.awt.Point;
import java.util.Timer;
import java.util.TimerTask;


public class MouseEventTest {
  private static double x;
  private static double y;
  
  
  public static void main(String[] args) {
    System.out.println("this is a mouse location test project.");
    Timer timer = new Timer();
    timer.schedule(new TimerTask(){
      @Override
      public void run(){
        Point point = MouseInfo.getPointerInfo().getLocation();
        if(x!=point.getX()&&y!=point.getY()){
          System.out.println("鼠标有移动");
        }else{
          System.out.println("鼠标没有移动");
        }
        x = point.getX();
        y = point.getY();
        System.out.println("Locotion:x="+point.getX()+" y="+point.getX());
      }
    },0,1000);
  }
}
